﻿namespace eg_017_函数递归与值传递

{
    internal class Program
    {
        static decimal Factorial(decimal n)
        {
            if (n == 0) { return 1; }
            else return n * Factorial(n);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("请输入一个整数：");
            decimal number = decimal.Parse(Console.ReadLine());
            Console.WriteLine("{0}的阶乘为{1}", number, Factorial(number));
        }
    }
}